
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Git 学习笔记 · 日常学习笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-footer-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="git小技巧.html" />
    
    
    <link rel="prev" href="./" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"buttons":[{"user":"Xiechengqi","repo":"LearningNotes","type":"star","size":"small","count":true}]};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../网络学习资源整理/">
            
                <a href="../网络学习资源整理/">
            
                    
                    网络学习资源整理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../网络学习资源整理/技术学习.html">
            
                <a href="../网络学习资源整理/技术学习.html">
            
                    
                    技术学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../网络学习资源整理/运维博客.html">
            
                <a href="../网络学习资源整理/运维博客.html">
            
                    
                    运维博客
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../网络学习资源整理/工具.html">
            
                <a href="../网络学习资源整理/工具.html">
            
                    
                    工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../网络学习资源整理/静态博客模板.html">
            
                <a href="../网络学习资源整理/静态博客模板.html">
            
                    
                    静态博客模板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../网络学习资源整理/静态网站pages服务.html">
            
                <a href="../网络学习资源整理/静态网站pages服务.html">
            
                    
                    静态网站pages服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../网络学习资源整理/静态pages的CI和CD.html">
            
                <a href="../网络学习资源整理/静态pages的CI和CD.html">
            
                    
                    静态pages的CI和CD
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../网络学习资源整理/Hugo学习.html">
            
                <a href="../网络学习资源整理/Hugo学习.html">
            
                    
                    Hugo学习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../心灵鸡汤/">
            
                <a href="../心灵鸡汤/">
            
                    
                    心灵鸡汤
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../心灵鸡汤/心灵鸡汤.html">
            
                <a href="../心灵鸡汤/心灵鸡汤.html">
            
                    
                    语录
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../Linux/">
            
                <a href="../Linux/">
            
                    
                    Linux
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../Linux/Linux常用命令.html">
            
                <a href="../Linux/Linux常用命令.html">
            
                    
                    Linux常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../Linux/Linux小知识.html">
            
                <a href="../Linux/Linux小知识.html">
            
                    
                    平时 linux 遇到的问题解决办法和扩展小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../Linux/Linux性能相关常用命令.html">
            
                <a href="../Linux/Linux性能相关常用命令.html">
            
                    
                    Linux性能相关常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../Linux/Linux各种安装下载慢解决方法.html">
            
                <a href="../Linux/Linux各种安装下载慢解决方法.html">
            
                    
                    Linux各种安装下载慢解决方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../Linux/APT-剖析详解.html">
            
                <a href="../Linux/APT-剖析详解.html">
            
                    
                    APT 原理剖析、详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../Linux/Linux主机、虚拟机和docker网络配置.html">
            
                <a href="../Linux/Linux主机、虚拟机和docker网络配置.html">
            
                    
                    Linux 主机、虚拟机和docker网络配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../Linux/Linux文件系统学习.html">
            
                <a href="../Linux/Linux文件系统学习.html">
            
                    
                    Linux文件系统学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../Linux/Linux用户和用户组管理.html">
            
                <a href="../Linux/Linux用户和用户组管理.html">
            
                    
                    Linux用户和用户组管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../Linux/Linux用户增删改等学习.html">
            
                <a href="../Linux/Linux用户增删改等学习.html">
            
                    
                    Linux用户增删改等学习.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../Linux/Linux程序存放目录.html">
            
                <a href="../Linux/Linux程序存放目录.html">
            
                    
                    Linux程序存放目录.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="../Linux/Linux编译安装软件包详解.html">
            
                <a href="../Linux/Linux编译安装软件包详解.html">
            
                    
                    Linux C/C++ 软件包编译、安装原理详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.12" data-path="../Linux/SSH详解.html">
            
                <a href="../Linux/SSH详解.html">
            
                    
                    SSH 详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.13" data-path="../Linux/Tomcat和Ngnix和Apache.html">
            
                <a href="../Linux/Tomcat和Ngnix和Apache.html">
            
                    
                    Tomcat和Ngnix和Apache.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.14" data-path="../Linux/UbuntuSoftwareInstall.html">
            
                <a href="../Linux/UbuntuSoftwareInstall.html">
            
                    
                    Ubuntu 软件包安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.15" data-path="../Linux/YAML-配置文件语言.html">
            
                <a href="../Linux/YAML-配置文件语言.html">
            
                    
                    YAML 配置文件语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.16" data-path="../Linux/bin目录详解.html">
            
                <a href="../Linux/bin目录详解.html">
            
                    
                    bin目录详解.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.17" data-path="../Linux/ffmpeg详解.html">
            
                <a href="../Linux/ffmpeg详解.html">
            
                    
                    ffmpeg学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.18" data-path="../Linux/trans命令.html">
            
                <a href="../Linux/trans命令.html">
            
                    
                    trans命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.19" data-path="../Linux/yum和rpm.html">
            
                <a href="../Linux/yum和rpm.html">
            
                    
                    Yum 和 RPM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.20" data-path="../Linux/从BashShell启动“窥探”Linux环境变量相关文件.html">
            
                <a href="../Linux/从BashShell启动“窥探”Linux环境变量相关文件.html">
            
                    
                    Linux环境变量详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.21" data-path="../Linux/新创建主机常用初始化配置.html">
            
                <a href="../Linux/新创建主机常用初始化配置.html">
            
                    
                    新建主机常用初始化配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.22" data-path="../Linux/正则表达式学习.html">
            
                <a href="../Linux/正则表达式学习.html">
            
                    
                    正则表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.23" data-path="../Linux/通过Linux开机启动项展开学习.html">
            
                <a href="../Linux/通过Linux开机启动项展开学习.html">
            
                    
                    Linux开机启动项学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.24" data-path="../Linux/防火墙学习.html">
            
                <a href="../Linux/防火墙学习.html">
            
                    
                    防火墙学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../Python/">
            
                <a href="../Python/">
            
                    
                    Python
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../Python/BeautifulSoup.md">
            
                <span>
            
                    
                    Python3 BeautifulSoup 学习记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Python/Django.html">
            
                <a href="../Python/Django.html">
            
                    
                    Python Django 学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Python/IPython使用技巧.html">
            
                <a href="../Python/IPython使用技巧.html">
            
                    
                    IPython 使用技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Python/Numpy.html">
            
                <a href="../Python/Numpy.html">
            
                    
                    Python Numpy 学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Python/Python小知识.html">
            
                <a href="../Python/Python小知识.html">
            
                    
                    Python 学习遇到的问题解决或扩展小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../Python/Python模块管理总结.html">
            
                <a href="../Python/Python模块管理总结.html">
            
                    
                    Python 模块管理总结
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../Python/flask学习.md">
            
                <span>
            
                    
                    Flask 学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../Python/matplotlib.html">
            
                <a href="../Python/matplotlib.html">
            
                    
                    matplotlib.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="../Python/re正则表达式.html">
            
                <a href="../Python/re正则表达式.html">
            
                    
                    re正则表达式.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="../Python/图形界面学习.html">
            
                <a href="../Python/图形界面学习.html">
            
                    
                    图形界面学习.md
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.11" data-path="../Python/常用图像库学习.html">
            
                <a href="../Python/常用图像库学习.html">
            
                    
                    Python3 常用图像库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.12" data-path="../Python/进阶学习.html">
            
                <a href="../Python/进阶学习.html">
            
                    
                    Python3 进阶学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../Shell/">
            
                <a href="../Shell/">
            
                    
                    Shell
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../Shell/shell小知识.html">
            
                <a href="../Shell/shell小知识.html">
            
                    
                    Shell小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../Shell/Shell奇淫技巧.html">
            
                <a href="../Shell/Shell奇淫技巧.html">
            
                    
                    Shell奇淫技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../Shell/Linux文本操作三大利器-grep、sed、awk.html">
            
                <a href="../Shell/Linux文本操作三大利器-grep、sed、awk.html">
            
                    
                    grep、sed、awk 详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../Shell/Shell文本处理常用工具补遗.html">
            
                <a href="../Shell/Shell文本处理常用工具补遗.html">
            
                    
                    Shell文本处理常用工具补遗
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../Shell/句子解析.html">
            
                <a href="../Shell/句子解析.html">
            
                    
                    句子解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../Shell/识别是否是root用户.html">
            
                <a href="../Shell/识别是否是root用户.html">
            
                    
                    识别是否是root用户
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../Shell/识别系统.html">
            
                <a href="../Shell/识别系统.html">
            
                    
                    识别系统
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../Vim/">
            
                <a href="../Vim/">
            
                    
                    Vim
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../Vim/Vim小知识.html">
            
                <a href="../Vim/Vim小知识.html">
            
                    
                    Vim小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../Vim/Vim编辑器再学习.html">
            
                <a href="../Vim/Vim编辑器再学习.html">
            
                    
                    Vim编辑器再学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../Vim/VimScript学习笔记.html">
            
                <a href="../Vim/VimScript学习笔记.html">
            
                    
                    VimScript 学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../Vim/YouCompleteMe安装.html">
            
                <a href="../Vim/YouCompleteMe安装.html">
            
                    
                    YouCompleteMe安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../Vim/vimrc示例1.html">
            
                <a href="../Vim/vimrc示例1.html">
            
                    
                    vimrc示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../Vim/vimrc备份.html">
            
                <a href="../Vim/vimrc备份.html">
            
                    
                    vimrc备份
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../Vim/Tmux快捷键.html">
            
                <a href="../Vim/Tmux快捷键.html">
            
                    
                    Tmux快捷键
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../Ansible/">
            
                <a href="../Ansible/">
            
                    
                    Ansible
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../Ansible/术语表.html">
            
                <a href="../Ansible/术语表.html">
            
                    
                    术语表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../Ansible/Ansible必知单词.html">
            
                <a href="../Ansible/Ansible必知单词.html">
            
                    
                    Ansible 常用单词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../Ansible/Ansible学习.html">
            
                <a href="../Ansible/Ansible学习.html">
            
                    
                    Ansible 学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../Ansible/Ansible常用模板.html">
            
                <a href="../Ansible/Ansible常用模板.html">
            
                    
                    Ansible常用模板.md
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../Docker/">
            
                <a href="../Docker/">
            
                    
                    Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../Docker/Docker基础学习.html">
            
                <a href="../Docker/Docker基础学习.html">
            
                    
                    Docker 基础学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../Docker/Docker小知识.html">
            
                <a href="../Docker/Docker小知识.html">
            
                    
                    Docker 小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../Docker/Docker必知单词.html">
            
                <a href="../Docker/Docker必知单词.html">
            
                    
                    Docker 学习中的单词
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="./">
            
                <a href="./">
            
                    
                    Git
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.10.1" data-path="git学习.html">
            
                <a href="git学习.html">
            
                    
                    Git 学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="git小技巧.html">
            
                <a href="git小技巧.html">
            
                    
                    Git 小技巧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../Zabbix/">
            
                <a href="../Zabbix/">
            
                    
                    Zabbix
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../Zabbix/Docker安装配置Zabbix.html">
            
                <a href="../Zabbix/Docker安装配置Zabbix.html">
            
                    
                    Docker 安装配置 Zabbix
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../Zabbix/术语单词.html">
            
                <a href="../Zabbix/术语单词.html">
            
                    
                    Zabbix 中常用单词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../Zabbix/重置密码.html">
            
                <a href="../Zabbix/重置密码.html">
            
                    
                    重置 Zabbix 账户密码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../KVM/">
            
                <a href="../KVM/">
            
                    
                    KVM
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../KVM/安装配置.html">
            
                <a href="../KVM/安装配置.html">
            
                    
                    常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../KVM/虚拟机网络配置.html">
            
                <a href="../KVM/虚拟机网络配置.html">
            
                    
                    Bridged 桥接模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../Mysql/">
            
                <a href="../Mysql/">
            
                    
                    Mysql
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../Mysql/Ubuntu安装Navicat.html">
            
                <a href="../Mysql/Ubuntu安装Navicat.html">
            
                    
                    Ubuntu 安装及配置 Navicat
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../Mysql/忘记root密码.html">
            
                <a href="../Mysql/忘记root密码.html">
            
                    
                    如何替换已忘记的 root 密码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../Nginx/">
            
                <a href="../Nginx/">
            
                    
                    Nginx
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../Nginx/Nginx学习笔记.html">
            
                <a href="../Nginx/Nginx学习笔记.html">
            
                    
                    Nginx 学习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../NoClass/">
            
                <a href="../NoClass/">
            
                    
                    闲知
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../NoClass/容易读错的IT术语.html">
            
                <a href="../NoClass/容易读错的IT术语.html">
            
                    
                    容易读错的IT术语
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../NoClass/Linux-electron-tutorial.html">
            
                <a href="../NoClass/Linux-electron-tutorial.html">
            
                    
                    Linux electron 学习记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../NoClass/MarkdownSkills.html">
            
                <a href="../NoClass/MarkdownSkills.html">
            
                    
                    记录 Markdown 的各种小技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="../NoClass/RaspeberryPi.html">
            
                <a href="../NoClass/RaspeberryPi.html">
            
                    
                    使用树莓派 3B 遇到的问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.5" data-path="../NoClass/华为国产手机芯片SoC.html">
            
                <a href="../NoClass/华为国产手机芯片SoC.html">
            
                    
                    华为国产手机芯片SoC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.6" data-path="../NoClass/图片格式详解及其对比.html">
            
                <a href="../NoClass/图片格式详解及其对比.html">
            
                    
                    图片格式详解及其对比
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.7" data-path="../NoClass/计算机小知识.html">
            
                <a href="../NoClass/计算机小知识.html">
            
                    
                    记录一些计算机的小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.8" data-path="../NoClass/诗词.html">
            
                <a href="../NoClass/诗词.html">
            
                    
                    诗词
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../OS/">
            
                <a href="../OS/">
            
                    
                    OS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.1" data-path="../OS/学习笔记.html">
            
                <a href="../OS/学习笔记.html">
            
                    
                    操作系统学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.2" data-path="../OS/术语单词.html">
            
                <a href="../OS/术语单词.html">
            
                    
                    OS 专业词语解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.3" data-path="../OS/SoCCPU.html">
            
                <a href="../OS/SoCCPU.html">
            
                    
                    SoC 与 CPU
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../Tomcat/">
            
                <a href="../Tomcat/">
            
                    
                    Tomcat
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" data-path="../Tomcat/Tomcat 学习.html">
            
                <a href="../Tomcat/Tomcat 学习.html">
            
                    
                    Tomcat 学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../Tomcat/Tomcat学习.html">
            
                <a href="../Tomcat/Tomcat学习.html">
            
                    
                    Tomcat 学习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../VPS/">
            
                <a href="../VPS/">
            
                    
                    VPS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.18.1" data-path="../VPS/AWS_lightsail.html">
            
                <a href="../VPS/AWS_lightsail.html">
            
                    
                    AWS LightSail
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.2" data-path="../VPS/GCP_VM实例创建和基本配置.html">
            
                <a href="../VPS/GCP_VM实例创建和基本配置.html">
            
                    
                    GCP VM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.3" data-path="../VPS/ECS和VPS等等.html">
            
                <a href="../VPS/ECS和VPS等等.html">
            
                    
                    ECS和VPS
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="../ComputerComposition/">
            
                <a href="../ComputerComposition/">
            
                    
                    ComputerComposition
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.19.1" data-path="../ComputerComposition/学习笔记.html">
            
                <a href="../ComputerComposition/学习笔记.html">
            
                    
                    计算机组成原理学习笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="../ComputerNetwork/">
            
                <a href="../ComputerNetwork/">
            
                    
                    ComputerNetwork
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.20.1" data-path="../ComputerNetwork/ProWords.html">
            
                <a href="../ComputerNetwork/ProWords.html">
            
                    
                    术语单词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.2" data-path="../ComputerNetwork/学习笔记.html">
            
                <a href="../ComputerNetwork/学习笔记.html">
            
                    
                    计算机网络学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.3" data-path="../ComputerNetwork/小知识.html">
            
                <a href="../ComputerNetwork/小知识.html">
            
                    
                    学习计算机网络中的小知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.4" data-path="../NoClass/浏览器架构简析.md">
            
                <span>
            
                    
                    浏览器架构简析
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="../毕业论文/">
            
                <a href="../毕业论文/">
            
                    
                    毕业论文
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.21.1" data-path="../毕业论文/开题报告.html">
            
                <a href="../毕业论文/开题报告.html">
            
                    
                    开题报告
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Git 学习笔记</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="git-&#x5B66;&#x4E60;&#x7B14;&#x8BB0;"><a name="git-&#x5B66;&#x4E60;&#x7B14;&#x8BB0;" class="plugin-anchor" href="#git-&#x5B66;&#x4E60;&#x7B14;&#x8BB0;"><i class="fa fa-link" aria-hidden="true"></i></a>Git &#x5B66;&#x4E60;&#x7B14;&#x8BB0;</h1>
<h2 id="&#x3010;&#x53C2;&#x8003;&#x3011;"><a name="&#x3010;&#x53C2;&#x8003;&#x3011;" class="plugin-anchor" href="#&#x3010;&#x53C2;&#x8003;&#x3011;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x3010;&#x53C2;&#x8003;&#x3011;</h2>
<blockquote>
<ul>
<li><a href="https://www.hi-linux.com/posts/60426.html" target="_blank">&#x5E38;&#x7528; Git &#x547D;&#x4EE4;&#x6E05;&#x5355;</a></li>
<li><a href="https://www.hi-linux.com/posts/3337.html" target="_blank">Git &#x7B80;&#x660E;&#x6307;&#x5357;</a></li>
<li><a href="http://marklodato.github.io/visual-git-guide/index-zh-cn.html" target="_blank">&#x56FE;&#x89E3;Git</a></li>
<li><a href="https://help.github.com/cn" target="_blank">Github &#x5E2E;&#x52A9;</a></li>
<li><a href="https://book.git-scm.com/" target="_blank">Git &#x5B98;&#x65B9;&#x6587;&#x6863;</a></li>
<li><a href="https://www.ruanyifeng.com/blog/2014/06/git_remote.html" target="_blank">Git&#x8FDC;&#x7A0B;&#x64CD;&#x4F5C;&#x8BE6;&#x89E3; - &#x962E;&#x4E00;&#x5CF0;</a></li>
</ul>
</blockquote>
<h2 id="&#x76EE;&#x5F55;"><a name="&#x76EE;&#x5F55;" class="plugin-anchor" href="#&#x76EE;&#x5F55;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x76EE;&#x5F55;</h2>
<p><strong><a href="#&#x5E38;&#x7528;&#x547D;&#x4EE4;">&#x5E38;&#x7528;&#x547D;&#x4EE4;</a></strong></p>
<p><strong><a href="#github-&#x52A0;&#x901F;">Github&#x52A0;&#x901F;</a></strong></p>
<p><strong><a href="#&#x67E5;&#x770B;&#x53D8;&#x66F4;&#x5185;&#x5BB9;---git%20diff">&#x67E5;&#x770B;&#x53D8;&#x66F4;&#x5185;&#x5BB9; - git diff</a></strong></p>
<p><strong><a href="#&#x56DE;&#x9000;">&#x56DE;&#x9000;</a></strong></p>
<p><strong><a href="#&#x5EFA;&#x7ACB;&#x3001;&#x5220;&#x9664;&#x3001;&#x4FEE;&#x6539;&#x8DDF;&#x8E2A;&#x5173;&#x7CFB;">&#x5EFA;&#x7ACB;&#x3001;&#x5220;&#x9664;&#x3001;&#x4FEE;&#x6539;&#x8DDF;&#x8E2A;&#x5173;&#x7CFB;</a></strong></p>
<p><strong><a href=""></a></strong></p>
<h2 id="&#x5E38;&#x7528;&#x547D;&#x4EE4;"><a name="&#x5E38;&#x7528;&#x547D;&#x4EE4;" class="plugin-anchor" href="#&#x5E38;&#x7528;&#x547D;&#x4EE4;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5E38;&#x7528;&#x547D;&#x4EE4;</h2>
<blockquote>
<ul>
<li>Workspace&#xFF1A;&#x5DE5;&#x4F5C;&#x533A;</li>
<li>Index / Stage&#xFF1A;&#x6682;&#x5B58;&#x533A;</li>
<li>Repository&#xFF1A;&#x4ED3;&#x5E93;&#x533A;&#xFF08;&#x6216;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#xFF09;</li>
<li>Remote&#xFF1A;&#x8FDC;&#x7A0B;&#x4ED3;&#x5E93;</li>
</ul>
</blockquote>
<ul>
<li><strong><code>&#x5DE5;&#x4F5C;&#x533A;</code></strong> -&gt; <strong><code>git add</code></strong> - &gt; <strong><code>&#x6682;&#x5B58;&#x533A;</code></strong>  -&gt; <strong><code>git commit</code></strong> -&gt; <strong><code>&#x672C;&#x5730;&#x4ED3;&#x5E93;</code></strong> -&gt; <strong><code>git push</code></strong> -&gt; <strong><code>&#x8FDC;&#x7A0B;&#x4ED3;&#x5E93;</code></strong></li>
<li>&#xFF0C;&#x540E;&#x7EED; <code>git commit</code>&#x5C31;&#x662F;&#x5F80; master &#x4E0A;&#x63D0;&#x4EA4;</li>
</ul>
<p><img src="images/git_command.png" alt=""></p>
<ul>
<li><strong><code>git init</code></strong> - &#x521D;&#x59CB;&#x5316; git &#x4ED3;&#x5E93;&#xFF0C;<code>git init</code> &#x65F6;&#x9ED8;&#x8BA4;&#x521B;&#x5EFA;&#x4E86;&#x4E00;&#x4E2A; master &#x5206;&#x652F;</li>
<li><strong><code>git init [RepName]</code></strong> - &#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#x76EE;&#x5F55; RepName&#xFF0C;&#x5E76;&#x5C06;&#x5176;&#x521D;&#x59CB;&#x5316;&#x4E3A; git &#x672C;&#x5730;&#x4ED3;&#x5E93;</li>
<li><strong><code>git ls-files</code></strong> - &#x67E5;&#x770B;&#x6682;&#x5B58;&#x533A;&#x6587;&#x4EF6;</li>
<li><strong><code>git rm [file]</code></strong> - &#x540C;&#x65F6;&#x5220;&#x9664;&#x5DE5;&#x4F5C;&#x533A;&#x548C;&#x6682;&#x5B58;&#x533A; file</li>
<li><strong><code>git mv [file1] [file2]</code></strong> - &#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x548C;&#x6682;&#x5B58;&#x533A;&#x540C;&#x65F6;&#x91CD;&#x547D;&#x540D; file1 &#x4E3A; file2</li>
<li><strong><code>git commit -m &lt;message&gt;</code></strong> - &#x63D0;&#x4EA4; ( commit ) &#x6682;&#x5B58;&#x533A;&#x5230;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#xFF0C;message &#x662F;&#x672C;&#x6B21;&#x63D0;&#x4EA4;&#x8BF4;&#x660E;</li>
<li><strong><code>git commit -a -m &lt;message&gt;</code></strong> - &#x4F1A;&#x81EA;&#x52A8;&#x6682;&#x5B58; modified&#x3001;deleted&#xFF0C;&#x4F46;&#x4E0D;&#x4F1A;&#x6682;&#x5B58; untracked &#x6587;&#x4EF6;&#xFF0C;&#x7136;&#x540E; commit</li>
</ul>
<h4 id="git-config"><a name="git-config" class="plugin-anchor" href="#git-config"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git config</code></strong></h4>
<ul>
<li><strong><code>git config</code></strong> - &#x4FEE;&#x6539; <code>./.git/config</code> &#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF0C;&#x5F53;&#x524D;&#x4ED3;&#x5E93;&#x914D;&#x7F6E;&#xFF0C;&#x76F8;&#x540C;&#x914D;&#x7F6E;&#x4F1A;&#x8986;&#x76D6;&#x7528;&#x6237;&#x548C;&#x7CFB;&#x7EDF;&#x914D;&#x7F6E;</li>
<li><strong><code>./.git/config</code></strong> - &#x5728; git &#x4ED3;&#x5E93;&#x76EE;&#x5F55;&#x4E0B;&#x6267;&#x884C;&#x8BE5;&#x547D;&#x4EE4;&#xFF0C;&#x540C; <code>git config</code></li>
<li><strong><code>git config --global</code></strong> - &#x4FEE;&#x6539; <code>~/.gitconfig</code> &#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF0C;&#x5F53;&#x524D;&#x7528;&#x6237;&#x914D;&#x7F6E;&#xFF0C;&#x4F1A;&#x8986;&#x76D6;&#x7CFB;&#x7EDF;&#x914D;&#x7F6E;</li>
<li><strong><code>git config --system</code></strong> - &#x4FEE;&#x6539; <code>/etc/gitconfig</code> &#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF0C;&#x7CFB;&#x7EDF;&#x914D;&#x7F6E;</li>
<li><strong><code>git config -l[--list]</code></strong> - &#x663E;&#x793A; system&#x3001;global&#x3001;local &#x914D;&#x7F6E;</li>
<li><strong><code>git config --local --list</code></strong> - &#x663E;&#x793A;&#x5F53;&#x524D;&#x4ED3;&#x5E93;&#x914D;&#x7F6E;</li>
<li><strong><code>git config --global --list</code></strong> - &#x663E;&#x793A;&#x7528;&#x6237;&#x914D;&#x7F6E;</li>
<li><strong><code>git config --system --list</code></strong> - &#x663E;&#x793A;&#x7CFB;&#x7EDF;&#x914D;&#x7F6E;</li>
<li><strong><code>git config [--global] user.name &quot;[name]&quot;</code></strong> - &#x8BBE;&#x7F6E;&#x63D0;&#x4EA4;&#x4EE3;&#x7801;&#x65F6;&#x7684;&#x7528;&#x6237;&#x540D;</li>
<li><strong><code>git config [--global] user.email &quot;[email]&quot;</code></strong> - &#x8BBE;&#x7F6E;&#x63D0;&#x4EA4;&#x4EE3;&#x7801;&#x65F6;&#x7684;&#x7528;&#x6237;&#x90AE;&#x7BB1;</li>
<li><strong><code>git config [--global] http.https://github.com.proxy socks5://127.0.0.1:1080</code></strong> - &#x914D;&#x7F6E; git github socks5 &#x4EE3;&#x7406;&#xFF0C;&#x6267;&#x884C; git &#x547D;&#x4EE4;&#x65F6;&#x53EA;&#x5BF9; github &#x4EE3;&#x7406;</li>
<li><strong><code>git config [--global] https.https://github.com.proxy socks5://127.0.0.1:1080</code></strong> - &#x914D;&#x7F6E; git github socks5 &#x4EE3;&#x7406; </li>
<li><strong><code>git config [--global] --unset http.https://github.com.proxy</code></strong> - &#x53D6;&#x6D88; github git &#x4EE3;&#x7406;</li>
</ul>
<h4 id="git-add"><a name="git-add" class="plugin-anchor" href="#git-add"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git add</code></strong></h4>
<ul>
<li><strong><code>git add &lt;file&gt;</code></strong> - &#x5DE5;&#x4F5C;&#x533A;&#x628A; file &#x6DFB;&#x52A0;&#x5230;&#x6682;&#x5B58;&#x533A;</li>
<li><strong><code>git add -u</code></strong> - &#x53EF;&#x4EE5;&#x6682;&#x5B58; ( stage ) &#x5DE5;&#x4F5C;&#x533A; modified&#x3001;deleted &#x6587;&#x4EF6;&#xFF0C;&#x4F46;&#x4E0D;&#x80FD;&#x6682;&#x5B58; untracked &#x6587;&#x4EF6;<ul>
<li><strong><code>git add --ignore-removal .</code></strong> - &#x53EF;&#x4EE5;&#x6682;&#x5B58;&#x5DE5;&#x4F5C;&#x533A; modified&#x3001;untracked &#x6587;&#x4EF6;&#xFF0C;&#x4F46;&#x4E0D;&#x80FD;&#x6682;&#x5B58; deleted &#x6587;&#x4EF6;</li>
</ul>
</li>
<li><strong><code>git add .</code></strong> - git 2.0+ &#x7248;&#x672C;&#x4E2D;&#xFF0C;&#x548C; <code>git add -A</code> &#x529F;&#x80FD;&#x4E00;&#x6837;&#xFF0C;&#x53EF;&#x4EE5;&#x6682;&#x5B58;&#x5DE5;&#x4F5C;&#x533A; modified&#x3001;deleted&#x3001;untracked &#x6587;&#x4EF6;</li>
<li><strong><code>git add -A</code></strong> - &#x6682;&#x5B58;&#x5DE5;&#x4F5C;&#x533A;&#x6240;&#x6709;&#x6587;&#x4EF6;&#x53D8;&#x5316; ( modified&#x3001;deleted&#x3001;untracked  )</li>
</ul>
<h4 id="git-status"><a name="git-status" class="plugin-anchor" href="#git-status"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git status</code></strong></h4>
<ul>
<li><strong><code>git status</code></strong> - &#x67E5;&#x770B;&#x5DE5;&#x4F5C;&#x533A;&#x548C;&#x6682;&#x5B58;&#x533A;&#x6587;&#x4EF6;&#x4FEE;&#x6539;&#x72B6;&#x6001;</li>
<li><strong><code>git status -s</code></strong> - <code>git status</code> &#x8F93;&#x51FA;&#x7CBE;&#x7B80;&#x7248;</li>
</ul>
<h4 id="git-log"><a name="git-log" class="plugin-anchor" href="#git-log"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git log</code></strong></h4>
<ul>
<li><strong><code>git log</code></strong>  - &#x67E5;&#x770B;&#x672C;&#x5730;&#x4ED3;&#x5E93; commit &#x8BB0;&#x5F55;</li>
<li><strong><code>git log --pretty=oneline</code></strong>  - &#x67E5;&#x770B;&#x672C;&#x5730;&#x4ED3;&#x5E93; commit &#x8BB0;&#x5F55;&#x53CA;&#x5BF9;&#x5E94; commit ID&#xFF0C;&#x4EE5;&#x5355;&#x884C;&#x5F62;&#x5F0F;&#x5C55;&#x793A;</li>
<li><strong><code>git reflog</code></strong> - &#x53EF;&#x4EE5;&#x67E5;&#x770B;&#x6240;&#x6709;&#x5206;&#x652F;&#x5BF9;&#x5F53;&#x524D;&#x4ED3;&#x5E93;&#x7684;&#x64CD;&#x4F5C;&#x8BB0;&#x5F55; ( commit / reset / checkout / merge / etc ) &#x4EE5;&#x53CA;&#x64CD;&#x4F5C;&#x7684; commit ID ( &#x65B9;&#x4FBF;&#x56DE;&#x9000;&#x5230;&#x67D0;&#x4E2A;&#x64CD;&#x4F5C;&#x65F6;&#x7248;&#x672C;&#x72B6;&#x6001; )</li>
</ul>
<h4 id="git-reset"><a name="git-reset" class="plugin-anchor" href="#git-reset"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git reset</code></strong></h4>
<ul>
<li><strong><code>git reset HEAD &lt;file&gt;</code></strong> -  <strong>&#x6682;&#x5B58;&#x533A;&#x64A4;&#x9500; file &#x4FEE;&#x6539;</strong>&#xFF0C;&#x628A;&#x6682;&#x5B58;&#x533A;&#x5185;&#x5173;&#x4E8E; file &#x7684;&#x4FEE;&#x6539;&#x56DE;&#x9000;&#x5230;&#x5DE5;&#x4F5C;&#x533A;</li>
<li><strong><code>git reset --hard HEAD^</code></strong> - &#x672C;&#x5730;&#x4ED3;&#x5E93;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21; commit &#x7248;&#x672C;</li>
<li><strong><code>git reset --hard HEAD~5</code></strong> - &#x672C;&#x5730;&#x4ED3;&#x5E93;&#x56DE;&#x9000;&#x5230; 5 &#x6B21; commit &#x524D;&#x7248;&#x672C;</li>
<li><strong><code>git reset --hard &lt;commit_ID&gt;</code></strong> - &#x672C;&#x5730;&#x4ED3;&#x5E93;&#x8DF3;&#x5230; commit_ID &#x5BF9;&#x5E94;&#x7684; commit &#x7248;&#x672C;</li>
</ul>
<h4 id="git-diff"><a name="git-diff" class="plugin-anchor" href="#git-diff"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git diff</code></strong></h4>
<ul>
<li><strong><code>git diff file</code></strong> - &#x67E5;&#x770B; file <strong>&#x5DE5;&#x4F5C;&#x533A;</strong>&#x548C;<strong>&#x6682;&#x5B58;&#x533A;</strong>&#x91CC;&#x7684;&#x533A;&#x522B;</li>
<li><strong><code>git diff HEAD</code></strong> - &#x67E5;&#x770B;&#x5DE5;&#x4F5C;&#x533A;&#x4E0E;&#x5F53;&#x524D;&#x5206;&#x652F;&#x6700;&#x65B0;commit&#x4E4B;&#x95F4;&#x7684;&#x5DEE;&#x5F02;</li>
<li><strong><code>git diff HEAD -- file</code></strong> - &#x67E5;&#x770B;&#x6587;&#x4EF6; file <strong>&#x5DE5;&#x4F5C;&#x533A;</strong>&#x548C;<strong>&#x5F53;&#x524D;&#x672C;&#x5730;&#x4ED3;&#x5E93;</strong>&#x4E4B;&#x95F4;&#x7684;&#x5DEE;&#x5F02;</li>
<li><strong><code>git diff --cached</code></strong> - &#x67E5;&#x770B;&#x5DF2;&#x6682;&#x5B58;&#x672A;&#x63D0;&#x4EA4;&#x7684;&#x5185;&#x5BB9;&#xFF0C;&#x53CA;&#x67E5;&#x770B;<strong>&#x6682;&#x5B58;&#x533A;</strong>&#x548C;<strong>&#x672C;&#x5730;&#x4ED3;&#x5E93;</strong>&#x91CC;&#x7684;&#x533A;&#x522B;</li>
</ul>
<h4 id="git-checkout"><a name="git-checkout" class="plugin-anchor" href="#git-checkout"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git checkout</code></strong></h4>
<ul>
<li><strong><code>git checkout &lt;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x5207;&#x6362;&#x5230;&#x5176;&#x4ED6;&#x5206;&#x652F;&#xFF0C;&#x5E76;&#x66F4;&#x65B0;&#x5DE5;&#x4F5C;&#x533A;</li>
<li><strong><code>git checkout -b &lt;newbranch&gt;</code></strong> - &#x521B;&#x5EFA;&#x5E76;&#x5207;&#x6362;&#x5230; newbranch &#x5206;&#x652F; </li>
<li><strong><code>git checkout -</code></strong> - &#x5207;&#x6362;&#x5230;&#x4E0A;&#x4E00;&#x5206;&#x652F;</li>
<li><strong><code>git checkout -- &lt;file&gt;</code></strong> - <strong>&#x5DE5;&#x4F5C;&#x533A;&#x64A4;&#x9500; file &#x4FEE;&#x6539;</strong>&#xFF0C;&#x5DE5;&#x4F5C;&#x533A;&#x7684; file &#x56DE;&#x9000;&#x5230;&#x6700;&#x8FD1;&#x4E00;&#x6B21; <code>git commit</code> &#x6216; <code>git add</code> &#x65F6;&#x7684;&#x72B6;&#x6001;</li>
<li><strong><code>git merge &lt;branch&gt;</code></strong> - &#x5408;&#x5E76; branch &#x5206;&#x652F;&#x5230;&#x5F53;&#x524D;&#x5206;&#x652F;</li>
<li><strong><code>git cherry-pick &lt;commit_ID&gt;</code></strong> - &#x9009;&#x62E9;&#x4E00;&#x4E2A; commit&#xFF0C;&#x5408;&#x5E76;&#x5230;&#x5F53;&#x524D;&#x5206;&#x652F;</li>
</ul>
<h4 id="git-switch"><a name="git-switch" class="plugin-anchor" href="#git-switch"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git switch</code></strong></h4>
<ul>
<li><strong><code>git switch -c &lt;branch&gt;</code></strong> - &#x5207;&#x6362;&#x5230; branch &#x5206;&#x652F;&#xFF0C;&#x6700;&#x65B0;&#x7248;&#x5207;&#x6362;&#x5206;&#x652F;&#x65B9;&#x5F0F;</li>
<li><strong><code>git switch master</code></strong> - &#x5207;&#x6362;&#x5230;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#x7684; master &#x4E3B;&#x5206;&#x652F;</li>
</ul>
<h4 id="git-branch"><a name="git-branch" class="plugin-anchor" href="#git-branch"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git branch</code></strong></h4>
<ul>
<li><strong>&#x663E;&#x793A;&#x6240;&#x6709;&#x5206;&#x652F;&#x548C;&#x7528; <code>*</code> &#x6807;&#x8BB0;&#x5F53;&#x524D;&#x6240;&#x5728;&#x5206;&#x652F;</strong></li>
<li><strong><code>git branch -r</code></strong> - &#x5217;&#x51FA;&#x6240;&#x6709;&#x8FDC;&#x7A0B;&#x5206;&#x652F;</li>
<li><strong><code>git branch -a</code></strong> - &#x5217;&#x51FA;&#x6240;&#x6709;&#x672C;&#x5730;&#x5206;&#x652F;&#x548C;&#x8FDC;&#x7A0B;&#x5206;&#x652F;</li>
<li><strong><code>git branch &lt;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#x5206;&#x652F;&#xFF0C;&#x4F46;&#x4F9D;&#x65E7;&#x505C;&#x5728;&#x5F53;&#x524D;&#x5206;&#x652F;</li>
<li><strong><code>git branch -d &lt;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x5220;&#x9664;&#x5206;&#x652F; ( &#x5220;&#x9664;&#x4E0D;&#x4E86;&#x5F53;&#x524D;&#x5206;&#x652F;&#xFF0C;&#x9700;&#x8981;&#x5148;&#x5207;&#x6362;&#x5230;&#x5176;&#x4ED6;&#x5206;&#x652F;; &#x4E5F;&#x5220;&#x9664;&#x4E0D;&#x4E86;&#x672A;&#x5408;&#x5E76;&#x7684;&#x5206;&#x652F; )</li>
<li><strong><code>git branch -D &lt;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x5F3A;&#x5236;&#x5220;&#x9664;&#x5206;&#x652F;</li>
<li><strong><code>git branch -vv</code></strong> - &#x67E5;&#x770B;&#x672C;&#x5730;&#x5206;&#x652F;&#x548C;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x7684;&#x8DDF;&#x8E2A;&#x5173;&#x7CFB;</li>
<li><strong><code>git branch --set-upstream-to=&lt;&#x4E3B;&#x673A;&#x540D;&gt;/&lt;&#x5206;&#x652F;&#x540D;&gt; &lt;&#x672C;&#x5730;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x4E3A;&#x672C;&#x5730;&#x5206;&#x652F;&#x521B;&#x5EFA;&#x8DDF;&#x8E2A;&#x5206;&#x652F;&#xFF0C;&#x8DDF;&#x8E2A;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x7684;&#x67D0;&#x4E2A;&#x5206;&#x652F;</li>
</ul>
<h4 id="git-clone"><a name="git-clone" class="plugin-anchor" href="#git-clone"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git clone</code></strong></h4>
<ul>
<li><strong><code>git clone [-o &lt;&#x4E3B;&#x673A;&#x540D;&gt;] &lt;&#x7248;&#x672C;&#x5E93;&#x7684;&#x7F51;&#x5740;&gt; [&lt;&#x672C;&#x5730;&#x76EE;&#x5F55;&#x540D;&gt;]</code></strong><ul>
<li><strong><code>git clone &lt;&#x7248;&#x672C;&#x5E93;&#x7684;&#x7F51;&#x5740;&gt;</code></strong> - &#x4ECE;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x514B;&#x9686;&#x4E00;&#x4E2A;&#x7248;&#x672C;&#x5E93;&#x5230;&#x672C;&#x5730;&#xFF0C;&#x4E14;&#x9ED8;&#x8BA4;&#x751F;&#x6210;&#x7684;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#x540D;&#x5C31;&#x662F;&#x8FDC;&#x7A0B;&#x7248;&#x672C;&#x5E93;&#x540D;</li>
<li><strong><code>&lt;&#x672C;&#x5730;&#x76EE;&#x5F55;&#x540D;&gt;</code></strong> - &#x6307;&#x5B9A;&#x514B;&#x9686;&#x5230;&#x672C;&#x5730;&#x7684;&#x7248;&#x672C;&#x5E93;&#x540D;&#x5B57;&#xFF0C;</li>
<li><strong><code>-o &lt;&#x4E3B;&#x673A;&#x540D;&gt;</code></strong> - &#x514B;&#x9686;&#x5E76;&#x6307;&#x5B9A;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&#xFF0C;&#x9ED8;&#x8BA4;&#x662F; origin</li>
</ul>
</li>
</ul>
<h4 id="git-remote"><a name="git-remote" class="plugin-anchor" href="#git-remote"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git remote</code></strong></h4>
<ul>
<li><strong>&#x5217;&#x51FA;&#x6240;&#x6709;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;</strong></li>
<li><strong><code>git remote -v</code></strong> - &#x53C2;&#x770B;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x7684;&#x7F51;&#x5740;</li>
<li><strong><code>git remote show &lt;&#x4E3B;&#x673A;&#x540D;&gt;</code></strong> - &#x67E5;&#x770B;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;</li>
<li><strong><code>git remote add &lt;&#x4E3B;&#x673A;&#x540D;&gt; &lt;&#x7248;&#x672C;&#x5E93;&#x7684;&#x7F51;&#x5740;&gt;</code></strong> - &#x6DFB;&#x52A0;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;</li>
<li><strong><code>git remote add origin git@github.com:username/reponame.git</code></strong> - &#x672C;&#x5730; git &#x4ED3;&#x5E93;&#x5173;&#x8054; github &#x4E0A;&#x7684;&#x4ED3;&#x5E93;</li>
<li><strong><code>git remote rm &lt;&#x4E3B;&#x673A;&#x540D;&gt;</code></strong> - &#x5220;&#x9664;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;</li>
<li><strong><code>git remote rename &lt;&#x539F;&#x4E3B;&#x673A;&#x540D;&gt; &lt;&#x65B0;&#x4E3B;&#x673A;&#x540D;&gt;</code></strong> - &#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x91CD;&#x547D;&#x540D;</li>
</ul>
<h4 id="git-fetch"><a name="git-fetch" class="plugin-anchor" href="#git-fetch"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git fetch</code></strong></h4>
<ul>
<li><strong><code>git fetch &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt;</code></strong> - &#x5C06;&#x67D0;&#x4E2A;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x7684;&#x66F4;&#x65B0;&#xFF0C;&#x5168;&#x90E8;&#x53D6;&#x56DE;&#x672C;&#x5730;</li>
<li><strong><code>git fetch &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt; &lt;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x53D6;&#x56DE;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x7279;&#x5B9A;&#x5206;&#x652F;&#x7684;&#x66F4;&#x65B0;&#xFF0C;&#x9ED8;&#x8BA4;&#x53D6;&#x56DE;&#x6240;&#x6709;&#x5206;&#x652F;&#x7684;&#x66F4;&#x65B0;</li>
<li><strong><code>git fetch origin master:temp</code></strong> - &#x4ECE;&#x8FDC;&#x7A0B;&#x7684; origin &#x4ED3;&#x5E93;&#x7684; master &#x5206;&#x652F;&#x4E0B;&#x8F7D;&#x5230;&#x672C;&#x5730;&#xFF0C;&#x5E76;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A; temp &#x5206;&#x652F;</li>
</ul>
<h4 id="git-pull"><a name="git-pull" class="plugin-anchor" href="#git-pull"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git pull</code></strong></h4>
<ul>
<li><strong>&#x53D6;&#x56DE;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x67D0;&#x4E2A;&#x5206;&#x652F;&#x7684;&#x66F4;&#x65B0;&#xFF0C;&#x518D;&#x4E0E;&#x672C;&#x5730;&#x7684;&#x6307;&#x5B9A;&#x5206;&#x652F;&#x5408;&#x5E76;</strong></li>
</ul>
<ul>
<li><strong><code>git pull &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt; &lt;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x540D;&gt;:&lt;&#x672C;&#x5730;&#x5206;&#x652F;&#x540D;&gt;</code></strong><ul>
<li><strong><code>git pull &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt; &lt;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x6307;&#x5B9A;&#x5206;&#x652F;&#x4E0E;&#x672C;&#x5730;&#x5F53;&#x524D;&#x5206;&#x652F;&#x5408;&#x5E76;</li>
<li><strong><code>git pull &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt;</code></strong> - &#x5F53;&#x524D;&#x5206;&#x652F;&#x8BBE;&#x7F6E;&#x4E86;&#x8DDF;&#x8E2A;&#x5206;&#x652F;</li>
<li><strong><code>git pull</code></strong> - &#x5F53;&#x524D;&#x5206;&#x652F;&#x53EA;&#x8BBE;&#x7F6E;&#x4E86;&#x4E00;&#x4E2A;&#x8DDF;&#x8E2A;&#x5206;&#x652F;</li>
</ul>
</li>
<li><strong><code>git pull -p</code></strong> - &#x5728;&#x672C;&#x5730;&#x5220;&#x9664;&#x8FDC;&#x7A0B;&#x5DF2;&#x7ECF;&#x5220;&#x9664;&#x7684;&#x5206;&#x652F;</li>
<li><strong><code>git pull --rebase</code></strong> - &#x5408;&#x5E76;&#x91C7;&#x7528; rebase &#x6A21;&#x5F0F;</li>
</ul>
<h4 id="git-push"><a name="git-push" class="plugin-anchor" href="#git-push"><i class="fa fa-link" aria-hidden="true"></i></a><strong><code>git push</code></strong></h4>
<ul>
<li><strong>&#x5C06;&#x672C;&#x5730;&#x5206;&#x652F;&#x7684;&#x66F4;&#x65B0;&#xFF0C;&#x63A8;&#x9001;&#x5230;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;</strong></li>
</ul>
<ul>
<li><strong><code>git push &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt; &lt;&#x672C;&#x5730;&#x5206;&#x652F;&#x540D;&gt;:&lt;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x540D;&gt;</code></strong><ul>
<li><strong><code>git push &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt; &lt;&#x672C;&#x5730;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x7701;&#x7565;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x540D;&#xFF0C;&#x5219;&#x8868;&#x793A;&#x5C06;&#x672C;&#x5730;&#x5206;&#x652F;&#x63A8;&#x9001;&#x4E0E;&#x4E4B;&#x5B58;&#x5728;&quot;&#x8FFD;&#x8E2A;&#x5173;&#x7CFB;&quot;&#x7684;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#xFF08;&#x901A;&#x5E38;&#x4E24;&#x8005;&#x540C;&#x540D;&#xFF09;&#xFF0C;&#x5982;&#x679C;&#x8BE5;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x5219;&#x4F1A;&#x88AB;&#x65B0;&#x5EFA;</li>
<li><strong><code>git push &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt; :&lt;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x7701;&#x7565;&#x672C;&#x5730;&#x5206;&#x652F;&#x540D;&#xFF0C;&#x5219;&#x8868;&#x793A;&#x5220;&#x9664;&#x6307;&#x5B9A;&#x7684;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x7B49;&#x540C;&#x4E8E;&#x63A8;&#x9001;&#x4E00;&#x4E2A;&#x7A7A;&#x7684;&#x672C;&#x5730;&#x5206;&#x652F;&#x5230;&#x8FDC;&#x7A0B;&#x5206;&#x652F;</li>
<li><strong><code>git push &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt;</code></strong> - &#x5F53;&#x524D;&#x5206;&#x652F;&#x4E0E;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x4E4B;&#x95F4;&#x5B58;&#x5728;&#x8FFD;&#x8E2A;&#x5173;&#x7CFB;</li>
<li><strong><code>git push</code></strong> - &#x5F53;&#x524D;&#x5206;&#x652F;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x8FFD;&#x8E2A;&#x5206;&#x652F;&#xFF0C;&#x90A3;&#x4E48;&#x4E3B;&#x673A;&#x540D;&#x90FD;&#x53EF;&#x4EE5;&#x7701;&#x7565;</li>
</ul>
</li>
<li><strong><code>git push &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt; --delete &lt;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x5220;&#x9664;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#xFF0C;&#x6548;&#x679C;&#x540C;&#x4E0A;</li>
<li><strong><code>git push -u &lt;&#x8FDC;&#x7A0B;&#x4E3B;&#x673A;&#x540D;&gt; &lt;&#x672C;&#x5730;&#x5206;&#x652F;&#x540D;&gt;:&lt;&#x8FDC;&#x7A0B;&#x5206;&#x652F;&#x540D;&gt;</code></strong> - &#x5F53;&#x524D;&#x5206;&#x652F;&#x4E0E;&#x591A;&#x4E2A;&#x4E3B;&#x673A;&#x5B58;&#x5728;&#x8FFD;&#x8E2A;&#x5173;&#x7CFB;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>-u</code> &#x9009;&#x9879;&#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x9ED8;&#x8BA4;&#x4E3B;&#x673A;&#xFF0C;&#x4E4B;&#x540E;&#x5C31;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x7528;<code>git push</code> </li>
<li><strong><code>git push -u origin master</code></strong> - &#x7B2C;&#x4E00;&#x6B21;&#x63A8;&#x9001; master &#x5206;&#x652F;&#xFF0C;<code>-u</code> &#x521B;&#x5EFA;&#x8DDF;&#x8E2A;&#x5173;&#x7CFB;&#xFF0C;&#x6307;&#x5B9A;&#x5F53;&#x524D;&#x5206;&#x652F;&#x7684; upstream</li>
<li><strong><code>git push origin master</code></strong> - &#x540E;&#x7EED;&#x672C;&#x5730;&#x63A8;&#x9001;&#x5230;&#x8FDC;&#x7A0B;&#x4ED3;&#x5E93;</li>
<li><strong>``</strong> - </li>
</ul>
<h2 id="github-&#x52A0;&#x901F;"><a name="github-&#x52A0;&#x901F;" class="plugin-anchor" href="#github-&#x52A0;&#x901F;"><i class="fa fa-link" aria-hidden="true"></i></a>Github &#x52A0;&#x901F;</h2>
<blockquote>
<ul>
<li><a href="https://mp.weixin.qq.com/s?__biz=MzI3MTI2NzkxMA==&amp;mid=2247484855&amp;idx=1&amp;sn=29531ce36a3f916b37441d2af79f30bc&amp;chksm=eac5249eddb2ad888c72d7bc151b566a1185cde4e59d38deb21a4b17e44660b064050667b4ce#rd" target="_blank">GitHub&#x52A0;&#x901F;&#x6700;&#x4F73;&#x5B9E;&#x8DF5;</a></li>
</ul>
</blockquote>
<ul>
<li>Git &#x76EE;&#x524D;&#x652F;&#x6301;&#x7684;&#x4E24;&#x79CD;&#x534F;&#x8BAE; <code>ssh://</code> &#x548C; <code>https://</code>&#xFF0C;&#x5176;&#x4EE3;&#x7406;&#x914D;&#x7F6E;&#x5404;&#x4E0D;&#x76F8;&#x540C;&#xFF1A;<code>http.proxy</code>&#x7528;&#x4E8E; <code>https://</code> &#x534F;&#x8BAE;&#xFF0C;<code>ssh://</code> &#x534F;&#x8BAE;&#x7684;&#x4EE3;&#x7406;&#x9700;&#x8981;&#x914D;&#x7F6E; <code>ssh</code> &#x7684; <code>ProxyCommand</code> &#x53C2;&#x6570;</li>
</ul>
<h4 id="&#x9488;&#x5BF9;https-&#x534F;&#x8BAE;https&#x914D;&#x7F6E;&#x4EE3;&#x7406;"><a name="&#x9488;&#x5BF9;https-&#x534F;&#x8BAE;https&#x914D;&#x7F6E;&#x4EE3;&#x7406;" class="plugin-anchor" href="#&#x9488;&#x5BF9;https-&#x534F;&#x8BAE;https&#x914D;&#x7F6E;&#x4EE3;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x9488;&#x5BF9;HTTPS &#x534F;&#x8BAE;(<a href="https://)&#x914D;&#x7F6E;&#x4EE3;&#x7406;" target="_blank">https://)&#x914D;&#x7F6E;&#x4EE3;&#x7406;</a></h4>
<p>&#x4E00;&#x3001;&#x4F7F;&#x7528; <strong><code>git config</code></strong></p>
<pre><code class="lang-bash"><span class="hljs-comment"># &#x5BF9;&#x6240;&#x6709;git&#x670D;&#x52A1;&#x5668;&#x8BBE;&#x7F6E;&#x4EE3;&#x7406;</span>
$ git config --global http.proxy http://127.0.0.1:&lt;port&gt;

<span class="hljs-comment"># &#x53EA;&#x5BF9;github.com&#x8BBE;&#x7F6E;&#x4EE3;&#x7406;</span>
$ git config --global http.https://github.com.proxy http://127.0.0.1:&lt;port&gt;

<span class="hljs-comment"># &#x4EE3;&#x7406;&#x9700;&#x8981;&#x5E10;&#x53F7;&#x5BC6;&#x7801;</span>
$ git config --global http.proxy http://&lt;proxyuser&gt;:&lt;proxypwd&gt;@&lt;proxy.server.com&gt;:&lt;port&gt;
<span class="hljs-comment">#proxyuser= &#x4EE3;&#x7406;&#x7684;&#x767B;&#x5F55;&#x7528;&#x6237;&#x540D;</span>
<span class="hljs-comment">#proxypwd= &#x4EE3;&#x7406;&#x7684;&#x767B;&#x5F55;&#x5BC6;&#x7801;</span>
<span class="hljs-comment">#proxy.server.com:1087 = &#x4EE3;&#x7406;&#x7684;ip&#xFF08;&#x6216;&#x57DF;&#x540D;&#xFF09;&#x4EE5;&#x53CA;&#x7AEF;&#x53E3;</span>
</code></pre>
<p>&#x4E8C;&#x3001;&#x7F16;&#x8F91; <code>~/.gitconfig</code> &#x6587;&#x4EF6;</p>
<pre><code class="lang-bash"><span class="hljs-comment"># &#x5BF9;&#x6240;&#x6709;git&#x670D;&#x52A1;&#x5668;&#x8BBE;&#x7F6E;&#x4EE3;&#x7406;</span>
[http]
    proxy = http://127.0.0.1:8123
[http]
    proxy = http://127.0.0.1:8123
<span class="hljs-comment"># &#x53EA;&#x5BF9;github.com&#x8BBE;&#x7F6E;&#x4EE3;&#x7406;</span>
[https <span class="hljs-string">&quot;https://github.com&quot;</span>]
    proxy = socks5://127.0.0.1:8123
[http <span class="hljs-string">&quot;https://github.com&quot;</span>]
    proxy = socks5://127.0.0.1:8123
</code></pre>
<h3 id="&#x9488;&#x5BF9;ssh-&#x534F;&#x8BAE;ssh&#x914D;&#x7F6E;&#x4EE3;&#x7406;"><a name="&#x9488;&#x5BF9;ssh-&#x534F;&#x8BAE;ssh&#x914D;&#x7F6E;&#x4EE3;&#x7406;" class="plugin-anchor" href="#&#x9488;&#x5BF9;ssh-&#x534F;&#x8BAE;ssh&#x914D;&#x7F6E;&#x4EE3;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x9488;&#x5BF9;SSH &#x534F;&#x8BAE;(ssh://)&#x914D;&#x7F6E;&#x4EE3;&#x7406;</h3>
<h2 id="&#x67E5;&#x770B;&#x53D8;&#x66F4;&#x5185;&#x5BB9;---git-diff"><a name="&#x67E5;&#x770B;&#x53D8;&#x66F4;&#x5185;&#x5BB9;---git-diff" class="plugin-anchor" href="#&#x67E5;&#x770B;&#x53D8;&#x66F4;&#x5185;&#x5BB9;---git-diff"><i class="fa fa-link" aria-hidden="true"></i></a>&#x67E5;&#x770B;&#x53D8;&#x66F4;&#x5185;&#x5BB9; - <strong><code>git diff</code></strong></h2>
<ul>
<li><strong><code>git diff file</code></strong> - &#x67E5;&#x770B; file <strong>&#x5DE5;&#x4F5C;&#x533A;</strong>&#x548C;<strong>&#x6682;&#x5B58;&#x533A;</strong>&#x91CC;&#x7684;&#x533A;&#x522B;</li>
<li><strong><code>git diff HEAD -- file</code></strong> - &#x67E5;&#x770B; file <strong>&#x5DE5;&#x4F5C;&#x533A;</strong>&#x548C;<strong>&#x672C;&#x5730;&#x4ED3;&#x5E93;</strong>&#x91CC;&#x7684;&#x533A;&#x522B;</li>
<li><strong><code>git diff --cached</code></strong> - &#x67E5;&#x770B;&#x5DF2;&#x6682;&#x5B58;&#x672A;&#x63D0;&#x4EA4;&#x7684;&#x5185;&#x5BB9;&#xFF0C;&#x53CA;&#x67E5;&#x770B;<strong>&#x6682;&#x5B58;&#x533A;</strong>&#x548C;<strong>&#x672C;&#x5730;&#x4ED3;&#x5E93;</strong>&#x91CC;&#x7684;&#x533A;&#x522B;</li>
</ul>
<pre><code class="lang-shell">git diff t
diff --git a/t b/t
index f007ede..d09b7e1 100644
--- a/t
+++ b/t
@@ -1,4 +1,4 @@
 &#x5403;&#x4E86;&#x5417;
 &#x5403;&#x4E86;
 &#x4F60;&#x5403;&#x4E86;&#x5417;
-&#x6CA1;&#x5403;
+&#x6211;&#x4E5F;&#x5403;&#x4E86;
</code></pre>
<ul>
<li><code>diff --git a/t b/t</code> - &#x5BF9;&#x6BD4;&#x4E24;&#x4E2A;&#x6587;&#x4EF6;&#xFF0C;&#x5176;&#x4E2D; a &#x6539;&#x52A8;&#x524D;&#xFF0C;b &#x662F;&#x6539;&#x52A8;&#x540E;</li>
<li><code>iindex f007ede..d09b7e1 10064</code> - &#x4E24;&#x4E2A;&#x7248;&#x672C;&#x7684; git &#x54C8;&#x5E0C;&#x503C;&#xFF0C;index &#x533A;&#x57DF;&#xFF08; add &#x4E4B;&#x540E;&#xFF09;&#x7684; f007ede &#x5BF9;&#x8C61;&#x548C;&#x5DE5;&#x4F5C;&#x533A;&#x57DF;&#x7684; d09b7e1 &#x5BF9;&#x8C61;&#xFF0C; <code>100</code> &#x8868;&#x793A;&#x666E;&#x901A;&#x6587;&#x4EF6;&#xFF0C;<code>644</code> &#x8868;&#x793A;&#x63A7;&#x5236;&#x6743;&#x9650;</li>
<li><code>--- a/t</code> - <code>---</code> &#x4EE3;&#x8868;&#x6E90;&#x6587;&#x4EF6;  </li>
<li><code>+++ b/t</code> - <code>+++</code> &#x4EE3;&#x8868;&#x76EE;&#x6807;&#x6587;&#x4EF6;  </li>
<li><code>@@ -1,2 +1,5 @</code> - <code>@@</code> &#x8868;&#x793A;&#x6587;&#x4EF6;&#x53D8;&#x52A8;&#x63CF;&#x8FF0;&#x5408;&#x5E76;&#x663E;&#x793A;&#x7684;&#x5F00;&#x59CB;&#x548C;&#x7ED3;&#x675F;&#xFF0C;&#x4E00;&#x822C;&#x5728;&#x53D8;&#x52A8;&#x524D;&#x540E;&#x591A;&#x663E;&#x793A;3&#x884C;&#xFF0C;&#x5176;&#x4E2D;-+&#x8868;&#x793A;&#x53D8;&#x52A8;&#x524D;&#x540E;&#xFF0C;&#x9017;&#x53F7;&#x524D;&#x662F;&#x8D77;&#x59CB;&#x884C;&#x4F4D;&#x7F6E;&#xFF0C;&#x9017;&#x53F7;&#x540E;&#x4E3A;&#x4ECE;&#x8D77;&#x59CB;&#x884C;&#x5F80;&#x540E;&#x51E0;&#x884C;&#x3002;&#x5408;&#x8D77;&#x6765;&#x5C31;&#x662F;&#x53D8;&#x52A8;&#x524D;&#x540E;&#x90FD;&#x662F;&#x4ECE;&#x7B2C;4&#x884C;&#x5F00;&#x59CB;&#xFF0C;&#x53D8;&#x52A8;&#x524D;&#x6587;&#x4EF6;&#x5F80;&#x540E;&#x6570;8&#x884C;&#x5BF9;&#x5E94;&#x53D8;&#x52A8;&#x540E;&#x6587;&#x4EF6;&#x5F80;&#x540E;&#x6570;9&#x884C;
&#x53D8;&#x52A8;&#x5185;&#x5BB9; &#x2014;&#x2014;+&#x8868;&#x793A;&#x589E;&#x52A0;&#x4E86;&#x8FD9;&#x4E00;&#x884C;&#xFF0C;-&#x8868;&#x793A;&#x5220;&#x9664;&#x4E86;&#x8FD9;&#x4E00;&#x884C;&#xFF0C;&#x6CA1;&#x7B26;&#x53F7;&#x8868;&#x793A;&#x6B64;&#x884C;&#x6CA1;&#x6709;&#x53D8;&#x52A8;&#x3002;</li>
</ul>
<p>&#x5F53;git status&#x544A;&#x8BC9;&#x4F60;&#x6709;&#x6587;&#x4EF6;&#x88AB;&#x4FEE;&#x6539;&#x8FC7;&#xFF0C;&#x7528;git diff&#x53EF;&#x4EE5;&#x67E5;&#x770B;&#x4FEE;&#x6539;&#x5185;&#x5BB9;</p>
<h2 id="&#x56DE;&#x9000;"><a name="&#x56DE;&#x9000;" class="plugin-anchor" href="#&#x56DE;&#x9000;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x56DE;&#x9000;</h2>
<ul>
<li><code>HEAD</code> &#x6307;&#x5411;&#x5F53;&#x524D;&#x7248;&#x672C;&#xFF0C;<code>HEAD^</code> &#x4E0A;&#x4E00;&#x4E2A;&#x7248;&#x672C;&#xFF0C;<code>HEAD~100</code> &#x4E4B;&#x524D; 100 &#x4E2A;&#x7684;&#x7248;&#x672C;</li>
</ul>
<h3 id="&#x7248;&#x672C;&#x56DE;&#x9000;---git-reset"><a name="&#x7248;&#x672C;&#x56DE;&#x9000;---git-reset" class="plugin-anchor" href="#&#x7248;&#x672C;&#x56DE;&#x9000;---git-reset"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7248;&#x672C;&#x56DE;&#x9000; - <strong><code>git reset</code></strong></h3>
<pre><code class="lang-shell"># &#x4F7F;&#x7528; git log --pretty=oneline &#x6216; git log &#x53EF;&#x4EE5;&#x67E5;&#x770B; commit &#x65E5;&#x5FD7;&#x53CA; commit ID
$ git log --pretty=oneline
14ab3268f5bda2287d04cd713e9df978b65bf381 create README
b61f11035eff9ca39acd7a8d98356b3060c5997d delete again README.md;
0e41957b5b5be1be7cabcffd09de3bf8ae297e60 modify README.md
6ed84a9599334f9e9632479860b2dfd038f6e2aa create test
9d0e11c192851639ccfba51436af852e6fd5a029 create README.md

# &#x4F7F;&#x7528; HEAD &#x56DE;&#x6EDA;&#x4E00;&#x6B21;
$ git reset --hard HEAD^
$ git log --pretty=oneline
b61f11035eff9ca39acd7a8d98356b3060c5997d delete again README.md;
0e41957b5b5be1be7cabcffd09de3bf8ae297e60 modify README.md
6ed84a9599334f9e9632479860b2dfd038f6e2aa create test
9d0e11c192851639ccfba51436af852e6fd5a029 create README.md

# &#x4F7F;&#x7528; HEAD &#x56DE;&#x6EDA;&#x4E24;&#x6B21;
git reset --hard HEAD~2
&#x91CD;&#x7F6E;&#x540E;&#x64A4;&#x51FA;&#x6682;&#x5B58;&#x533A;&#x7684;&#x53D8;&#x66F4;&#xFF1A;
D    README.md
$ git log --pretty=oneline
6ed84a9599334f9e9632479860b2dfd038f6e2aa create test
9d0e11c192851639ccfba51436af852e6fd5a029 create README.md

# &#x4F7F;&#x7528; commid ID &#x56DE;&#x5230;&#x201C;&#x672A;&#x6765;&#x201D;&#x7248;&#x672C;
$ git reset --hard 14ab
$ git log --pretty=oneline
14ab3268f5bda2287d04cd713e9df978b65bf381 create README
b61f11035eff9ca39acd7a8d98356b3060c5997d delete again README.md;
0e41957b5b5be1be7cabcffd09de3bf8ae297e60 modify README.md
6ed84a9599334f9e9632479860b2dfd038f6e2aa create test
9d0e11c192851639ccfba51436af852e6fd5a029 create README.md

# &#x4F7F;&#x7528; git reflog &#x67E5;&#x770B;&#x5404;&#x4E2A;&#x7248;&#x672C;&#x7684; commit ID &#x524D; 7 &#x4F4D;&#xFF0C;&#x4EE5;&#x4F9B;&#x8FD4;&#x56DE;&#x5BF9;&#x5E94;&#x7248;&#x672C;&#xFF08; git reset commitID &#xFF09;
 $ git reflog
14ab326 HEAD@{0}: reset: moving to 14ab
6ed84a9 HEAD@{1}: reset: moving to HEAD~2
b61f110 HEAD@{2}: reset: moving to HEAD^
14ab326 HEAD@{3}: reset: moving to 14ab3
0e41957 HEAD@{4}: reset: moving to HEAD^
b61f110 HEAD@{5}: reset: moving to HEAD^
14ab326 HEAD@{6}: commit: create README
b61f110 HEAD@{7}: commit: delete again README.md;
0e41957 HEAD@{8}: commit: modify README.md
6ed84a9 HEAD@{9}: commit: create test
9d0e11c HEAD@{10}: commit (initial): create README.md
</code></pre>
<h3 id="&#x4FEE;&#x6539;&#x56DE;&#x9000;--git-checkout-git-reset"><a name="&#x4FEE;&#x6539;&#x56DE;&#x9000;--git-checkout-git-reset" class="plugin-anchor" href="#&#x4FEE;&#x6539;&#x56DE;&#x9000;--git-checkout-git-reset"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4FEE;&#x6539;&#x56DE;&#x9000;- <strong><code>git checkout</code></strong> <strong><code>git reset</code></strong></h3>
<ol>
<li><p>&#x5DE5;&#x4F5C;&#x533A; file &#x4FEE;&#x6539;&#x7684;&#x56DE;&#x9000;</p>
</li>
<li><p><strong><code>git checkout -- &lt;file&gt;</code></strong> </p>
</li>
<li><p>&#x5DE5;&#x4F5C;&#x533A; file &#x4FEE;&#x6539;&#x64A4;&#x9500;&#xFF0C;<strong>&#x5DE5;&#x4F5C;&#x533A;&#x7684; file &#x56DE;&#x9000;&#x5230;&#x6700;&#x8FD1;&#x4E00;&#x6B21; <code>git commit</code> &#x6216; <code>git add</code> &#x65F6;&#x7684;&#x72B6;&#x6001;</strong></p>
<ul>
<li><code>&#x4E0A;&#x6B21; commit</code> -&gt; <code>&#x4FEE;&#x6539; file</code> -&gt; <code>git checkout -- file</code> -&gt; <code>file &#x56DE;&#x9000;&#x5230;&#x4E0A;&#x6B21; commit</code></li>
<li><code>&#x4E0A;&#x6B21; commit</code> -&gt; <code>&#x4FEE;&#x6539; file</code> -&gt; <code>git add file</code> -&gt; <code>git checkout -- file</code> -&gt; <code>file &#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21; add &#x540E;&#x72B6;&#x6001;</code></li>
</ul>
</li>
<li><p>&#x6682;&#x5B58;&#x533A; file &#x4FEE;&#x6539;&#x7684;&#x56DE;&#x9000;</p>
</li>
<li><p><strong><code>git reset HEAD &lt;file&gt;</code></strong></p>
</li>
<li>&#x6682;&#x5B58;&#x533A; file &#x4FEE;&#x6539;&#x64A4;&#x9500;&#xFF0C;<strong>&#x628A;&#x6682;&#x5B58;&#x533A;&#x5185;&#x5173;&#x4E8E; file &#x7684;&#x4FEE;&#x6539;&#x5168;&#x90E8;&#x56DE;&#x9000;&#x5230;&#x5DE5;&#x4F5C;&#x533A;</strong></li>
</ol>
<h3 id="&#x5220;&#x9664;&#x56DE;&#x9000;"><a name="&#x5220;&#x9664;&#x56DE;&#x9000;" class="plugin-anchor" href="#&#x5220;&#x9664;&#x56DE;&#x9000;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5220;&#x9664;&#x56DE;&#x9000;</h3>
<p><strong><code>git rm file</code></strong> - &#x540C;&#x65F6;&#x5220;&#x9664;&#x5DE5;&#x4F5C;&#x533A;&#x548C;&#x6682;&#x5B58;&#x533A; file - <strong><code>&#x8FD8;&#x539F;&#xFF1A;git reset HEAD file + git checkout file</code></strong></p>
<p><strong><code>rm file</code></strong> - &#x53EA;&#x5220;&#x9664;&#x5DE5;&#x4F5C;&#x533A;&#x91CC;&#x7684; file - <strong><code>&#x8FD8;&#x539F;&#xFF1A;git checkout file</code></strong></p>
<h3 id="&#x91CD;&#x547D;&#x540D;&#x56DE;&#x9000;"><a name="&#x91CD;&#x547D;&#x540D;&#x56DE;&#x9000;" class="plugin-anchor" href="#&#x91CD;&#x547D;&#x540D;&#x56DE;&#x9000;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x91CD;&#x547D;&#x540D;&#x56DE;&#x9000;</h3>
<p><strong><code>mv file file1</code></strong> - &#x53EA;&#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x91CC;&#x91CD;&#x547D;&#x540D; file &#x4E3A; file1 - <strong><code>&#x8FD8;&#x539F;&#xFF1A;git checkout file + rm file1 -rf</code></strong></p>
<p><strong><code>git mv file file1</code></strong> - &#x540C;&#x65F6;&#x91CD;&#x547D;&#x540D;&#x5DE5;&#x4F5C;&#x533A;&#x548C;&#x6682;&#x5B58;&#x533A; file &#x4E3A; file1 - <strong><code>&#x8FD8;&#x539F;&#xFF1A;git reset HEAD file + git checkout file + rm file1 -rf</code></strong></p>
<blockquote>
<ul>
<li>note: &#x91CD;&#x547D;&#x540D; file file1 = &#x5220;&#x9664; file + &#x65B0;&#x5EFA; file1&#xFF08; &#x548C; file &#x5185;&#x5BB9;&#x76F8;&#x540C; &#xFF09;</li>
</ul>
</blockquote>
<h2 id="&#x5EFA;&#x7ACB;&#x3001;&#x5220;&#x9664;&#x3001;&#x4FEE;&#x6539;&#x8DDF;&#x8E2A;&#x5173;&#x7CFB;"><a name="&#x5EFA;&#x7ACB;&#x3001;&#x5220;&#x9664;&#x3001;&#x4FEE;&#x6539;&#x8DDF;&#x8E2A;&#x5173;&#x7CFB;" class="plugin-anchor" href="#&#x5EFA;&#x7ACB;&#x3001;&#x5220;&#x9664;&#x3001;&#x4FEE;&#x6539;&#x8DDF;&#x8E2A;&#x5173;&#x7CFB;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5EFA;&#x7ACB;&#x3001;&#x5220;&#x9664;&#x3001;&#x4FEE;&#x6539;&#x8DDF;&#x8E2A;&#x5173;&#x7CFB;</h2>
<p>1&#x3001;git clone<code>&#x65F6;&#x81EA;&#x52A8;&#x521B;&#x5EFA;</code>master<code>&#x5206;&#x652F;&#x8FFD;&#x8E2A;</code>origin/master` &#x5206;&#x652F;</p>
<pre><code class="lang-bash">$ git <span class="hljs-built_in">clone</span> git@github.com:Xiechengqi/test.git testbook
&#x6B63;&#x514B;&#x9686;&#x5230; <span class="hljs-string">&apos;testbook&apos;</span>...
. . .
$ <span class="hljs-built_in">cd</span> testbook
$ git branch -vv
* master 77418ad [origin/master] Update index.html
</code></pre>
<h2 id="&#x6848;&#x4F8B;&#x5B9E;&#x64CD;"><a name="&#x6848;&#x4F8B;&#x5B9E;&#x64CD;" class="plugin-anchor" href="#&#x6848;&#x4F8B;&#x5B9E;&#x64CD;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6848;&#x4F8B;&#x5B9E;&#x64CD;</h2>
<h3 id="&#x4E00;&#x3001;file-&#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x4FEE;&#x6539;&#x5E76;-add-&#x4E00;&#x6B21;&#xFF0C;&#x4E4B;&#x540E;&#x53C8;&#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x4FEE;&#x6539;&#x4E86;&#xFF0C;&#x6B64;&#x65F6;&#x53EF;&#x4EE5;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21;-add-&#x72B6;&#x6001;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21;-commit-&#x72B6;&#x6001;"><a name="&#x4E00;&#x3001;file-&#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x4FEE;&#x6539;&#x5E76;-add-&#x4E00;&#x6B21;&#xFF0C;&#x4E4B;&#x540E;&#x53C8;&#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x4FEE;&#x6539;&#x4E86;&#xFF0C;&#x6B64;&#x65F6;&#x53EF;&#x4EE5;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21;-add-&#x72B6;&#x6001;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21;-commit-&#x72B6;&#x6001;" class="plugin-anchor" href="#&#x4E00;&#x3001;file-&#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x4FEE;&#x6539;&#x5E76;-add-&#x4E00;&#x6B21;&#xFF0C;&#x4E4B;&#x540E;&#x53C8;&#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x4FEE;&#x6539;&#x4E86;&#xFF0C;&#x6B64;&#x65F6;&#x53EF;&#x4EE5;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21;-add-&#x72B6;&#x6001;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21;-commit-&#x72B6;&#x6001;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E00;&#x3001;file &#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x4FEE;&#x6539;&#x5E76; add &#x4E00;&#x6B21;&#xFF0C;&#x4E4B;&#x540E;&#x53C8;&#x5728;&#x5DE5;&#x4F5C;&#x533A;&#x4FEE;&#x6539;&#x4E86;&#xFF0C;&#x6B64;&#x65F6;&#x53EF;&#x4EE5;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21; add &#x72B6;&#x6001;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x4E00;&#x6B21; commit &#x72B6;&#x6001;</h3>
<p><strong>&#x5DE5;&#x4F5C;&#x533A;&#x5185;&#x64CD;&#x4F5C;&#x6587;&#x4EF6; file &#x53EA;&#x8981;&#x6CA1; commit &#x90FD;&#x80FD;&#x56DE;&#x9000;&#x5230;&#x4E0A;&#x6B21; commit &#x65F6;&#x7684;&#x7248;&#x672C;</strong></p>
<p>1&#x3001;&#x6CA1;&#x6709; <code>git add</code> &#x65F6;&#xFF0C;&#x7528; <code>git checkout -- file</code></p>
<p>2&#x3001;&#x5DF2;&#x7ECF; <code>git add</code> &#x65F6;&#xFF0C;&#x5148; <code>git reset HEAD &lt;file&gt;</code> &#x56DE;&#x9000;&#x5230; 1&#xFF0C;&#x518D;&#x6309; 1 &#x64CD;&#x4F5C;</p>
<pre><code class="lang-shell">$ git status -s
$ cat test
&#x4F60;&#x597D;
&#x4F60;&#x4E5F;&#x597D;
&#x4ED6;&#x4E5F;&#x597D;
$ echo &apos;hello&apos; &gt; test
$ git add test
$ echo &apos;hello world!&apos; &gt; test
$ git status -s
MM test

# &#x6B64;&#x65F6;&#x5DE5;&#x4F5C;&#x533A;&#x3001;&#x6682;&#x5B58;&#x533A;&#x548C;&#x4ED3;&#x5E93;&#x5185;&#x7684; file &#x90FD;&#x4E0D;&#x76F8;&#x540C;
# &#x5DE5;&#x4F5C;&#x533A;&#x548C;&#x6682;&#x5B58;&#x533A;&#x6BD4;&#x8F83;
$ git diff test
diff --git a/test b/test
index ce01362..a042389 100644
--- a/test
+++ b/test
@@ -1 +1 @@
-hello
+hello world!
# &#x5DE5;&#x4F5C;&#x533A;&#x548C;&#x4ED3;&#x5E93;&#x6BD4;&#x8F83;
git diff HEAD -- test
diff --git a/test b/test
index f9132cb..a042389 100644
--- a/test
+++ b/test
@@ -1,3 +1 @@
-&#x4F60;&#x597D;
-&#x4F60;&#x4E5F;&#x597D;
-&#x4ED6;&#x4E5F;&#x597D;
+hello world!

### &#x56DE;&#x9000;&#x8FD8;&#x539F;
# &#x5148;&#x56DE;&#x9000;&#x6682;&#x5B58;&#x533A;&#x4E0E;&#x5426;&#x65E0;&#x6240;&#x8C13;&#xFF0C;&#x5148;&#x9000;&#x56DE;&#x6682;&#x5B58;&#x533A;&#x6BD4;&#x5148;&#x9000;&#x56DE;&#x5DE5;&#x4F5C;&#x533A;&#x5C11;&#x4E00;&#x6B65;&#x64CD;&#x4F5C;&#x800C;&#x5DF2;
git reset HEAD test           # &#x56DE;&#x9000;&#x6682;&#x5B58;&#x533A;
&#x91CD;&#x7F6E;&#x540E;&#x53D6;&#x6D88;&#x6682;&#x5B58;&#x7684;&#x53D8;&#x66F4;&#xFF1A;
M    test
$ git status -s
 M test
$ git checkout test              # &#x56DE;&#x9000;&#x5DE5;&#x4F5C;&#x533A;
$ git status -s
$ cat test
&#x4F60;&#x597D;
&#x4F60;&#x4E5F;&#x597D;
&#x4ED6;&#x4E5F;&#x597D;
</code></pre>
<h3 id="&#x4E8C;&#x3001;&#x66F4;&#x65B0;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#x81F3;&#x6700;&#x65B0;&#x6539;&#x52A8;"><a name="&#x4E8C;&#x3001;&#x66F4;&#x65B0;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#x81F3;&#x6700;&#x65B0;&#x6539;&#x52A8;" class="plugin-anchor" href="#&#x4E8C;&#x3001;&#x66F4;&#x65B0;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#x81F3;&#x6700;&#x65B0;&#x6539;&#x52A8;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E8C;&#x3001;&#x66F4;&#x65B0;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#x81F3;&#x6700;&#x65B0;&#x6539;&#x52A8;</h3>
<p><strong><code>git pull</code> = <code>git fetch</code> + <code>git merge</code></strong> </p>
<p><strong>&#x65B9;&#x6CD5;&#x4E00;&#x3001;<code>git pull</code></strong></p>
<pre><code class="lang-shell"># &#x5728;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#x6267;&#x884C; git pull&#xFF0C;&#x4FBF;&#x81EA;&#x52A8;&#x66F4;&#x65B0;&#x4F60;&#x7684;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#x81F3;&#x6700;&#x65B0;&#x6539;&#x52A8;
$ git pull
</code></pre>
<p><strong>&#x65B9;&#x6CD5;&#x4E8C;&#x3001;<code>git fetch</code> + <code>git merge</code></strong></p>
<ul>
<li><p>&#x5982;&#x679C;&#x8FDC;&#x7A0B;&#x4ED3;&#x5E93;&#x5206;&#x652F;&#x548C;&#x672C;&#x5730;&#x4ED3;&#x5E93;&#x5F53;&#x524D;&#x5206;&#x652F;&#x90FD;&#x4FEE;&#x6539;&#x4E86;&#x540C;&#x4E00;&#x6587;&#x4EF6;&#x7684;&#x540C;&#x4E00;&#x4F4D;&#x7F6E;&#xFF08;&#x90FD;&#x4FEE;&#x6539;&#x4E86;&#x540C;&#x4E00;&#x6587;&#x4EF6;&#x662F;&#x53EF;&#x4EE5;&#x7684;&#xFF09;&#xFF0C;&#x8FD9;&#x5C31;&#x4F1A;&#x5BFC;&#x81F4; merge &#x5931;&#x8D25;&#xFF0C;&#x9700;&#x8981;&#x624B;&#x52A8;&#x4FEE;&#x6539;&#x8FDC;&#x7A0B;&#x6216;&#x672C;&#x5730;&#x5176;&#x4E00;</p>
<pre><code class="lang-shell">$ git fetch origin master:temp
&#x6765;&#x81EA; github.com:Xiechengqi/wiki
 * [&#x65B0;&#x5206;&#x652F;]          master     -&gt; temp
$ git diff temp    # &#x67E5;&#x770B;&#x5F53;&#x524D;&#x5206;&#x652F; master &#x548C; temp &#x5206;&#x652F;&#x7684;&#x4E0D;&#x540C;
diff --git a/index.md b/index.md
deleted file mode 100644
index c0cd5ef..0000000
--- a/index.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# &#x76EE;&#x5F55;
-
-* [hello world](./hello.md)
diff --git a/index.rst b/index.rst
new file mode 100644
index 0000000..42cee67
--- /dev/null
+++ b/index.rst
@@ -0,0 +1,20 @@

$ git merge temp       # &#x5408;&#x5E76; temp &#x5230;&#x5F53;&#x524D;&#x5206;&#x652F; master
&#x66F4;&#x65B0; 7df7451..36ce930
Fast-forward
 index.md  |  3 +++
 index.rst | 20 --------------------
 2 files changed, 3 insertions(+), 20 deletions(-)
 create mode 100644 index.md
 delete mode 100644 index.rst

$ git brach -d temp       # &#x5220;&#x9664; temp &#x5206;&#x652F;
</code></pre>
</li>
</ul>
<footer class="page-footer-ex"> <span class="page-footer-ex-copyright"> <a href="https://github.com/Xiechengqi" target="_blank">Xiechengqi</a> </span> &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; <span class="page-footer-ex-footer-update"> <strong>&#x6700;&#x65B0;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;</strong> 2020-03-28 10:11:04 </span> </footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="./" class="navigation navigation-prev " aria-label="Previous page: Git">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="git小技巧.html" class="navigation navigation-next " aria-label="Next page: Git 小技巧">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Git 学习笔记","level":"1.10.1","depth":2,"next":{"title":"Git 小技巧","level":"1.10.2","depth":2,"path":"Git/git小技巧.md","ref":"Git/git小技巧.md","articles":[]},"previous":{"title":"Git","level":"1.10","depth":1,"path":"Git/README.md","ref":"Git/README.md","articles":[{"title":"Git 学习笔记","level":"1.10.1","depth":2,"path":"Git/git学习.md","ref":"Git/git学习.md","articles":[]},{"title":"Git 小技巧","level":"1.10.2","depth":2,"path":"Git/git小技巧.md","ref":"Git/git小技巧.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-lunr","-search","-livereload","-sharing","expandable-chapters","popup","pageview-count","code","back-to-top-button","hide-element","github-buttons","github","splitter","search-pro","anchors","page-footer-ex","advanced-emoji","sharing-plus"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/Xiechengqi/LearningNotes"},"page-footer-ex":{"copyright":"[Xiechengqi](https://github.com/Xiechengqi)","markdown":true,"update_format":"YYYY-MM-DD HH:mm:ss","update_label":"<strong>最新修订时间：</strong>"},"splitter":{},"search-pro":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"popup":{},"code":{"copyButtons":true},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"back-to-top-button":{},"pageview-count":{},"github-buttons":{"buttons":[{"user":"Xiechengqi","repo":"LearningNotes","type":"star","size":"small","count":true}]},"advanced-emoji":{"embedEmojis":false},"sharing":{"qq":false,"douban":false,"facebook":false,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"expandable-chapters":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"日常学习笔记","language":"zh-hans","gitbook":"*","description":"日常学习笔记"},"file":{"path":"Git/git学习.md","mtime":"2020-03-28T02:11:04.753Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-28T02:57:41.582Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

